import React, { Component } from 'react';
import './index.css'
import Header from '../../components/header'
import Back from '../../components/Back';
import { Link } from 'react-router-dom';
import { Input,Button } from 'antd';
import {goRegister} from '../../api/api'

class Index extends Component {
    constructor(){
        super();
        this.state={
            phone:'',
            password:'',
        }
    }
    async doRegister(){
        let res=await goRegister(this.state)
        console.log(res);
    }
    render() {
        return (
            <div className='register'>
                <Header title='注册'></Header>
                <Back></Back>
                <main>
                    <img src={require('../../assets/image/piclogoorange.png')} alt="" />
                    <br />
                    <Input size="large" prefix='手机号' bordered={true} value={this.state.phone} onChange={(e)=>{this.setState({phone:e.target.value})}}/><br />
                    <Input size="large" prefix='密码' bordered={true} value={this.state.password} onChange={(e)=>{this.setState({password:e.target.value})}}/><br />
                    <Button type="primary" shape="round" size='large' block onClick={()=>{this.doRegister()}}>注册</Button>
                    <Link to='/login'>已有账号？去登录</Link>
                </main>
            </div>
        );
    }
}

export default Index;